using System;
using System.Data;
using System.Configuration;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using LinFen;
using SubSonic;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void imgbtnSubmit_Click(object sender, ImageClickEventArgs e)
    {
            Query q=new Query("AdminInfo");
            q.AddWhere("AdminName", tbUserName.Text)
                .AddWhere("AdminPassWD", tbPassWD.Text);
            IDataReader dr = q.ExecuteReader();
            if (q.GetCount("ID")> 0)
            {
                dr.Read();
                Cookies c = new Cookies();
                c.addCookies("cID", dr["ID"].ToString(), 0);
                c.addCookies("cCityID", dr["CityID"].ToString(), 0);
                c.addCookies("cDistrictID",dr["districtID"].ToString(),0);
                c.addCookies("cAdminName", dr["adminName"].ToString(), 0);
                c.addCookies("cFlag", dr["Flag"].ToString(), 0);
                c.addCookies("corderFlag", dr["orderflag"].ToString(), 0);
                c.addCookies("cisType",dr["isType"].ToString(),0);
                if(dr["isType"].ToString()=="5")
                {
                    Query _q = new Query("CustomerInfo");
                    _q.AddWhere("customername", tbUserName.Text);
                    c.addCookies("cCustomerID",_q.ExecuteScalar().ToString(),0);
                }
                StoredProcedure sp = new StoredProcedure("sp_ExcuteOrder");
                sp.Command.AddParameter("@oID",0);
                sp.Execute();
                
                Response.Redirect("~/Main.aspx");
            }

    }
}